import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    themeConfig: {
      isSetting: false, // 是否在进行模块配置中
      backgroundTheme: '0', // 背景图主题
      moduleTheme: 'flat', // 模块主题 [default, flat]
      echartsTheme: 'flat' // echarts主题 [default, flat]
    },
    moduleList: [
      {
        id: '1',
        name: '基础信息',
        moduleType: '2x2',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '2',
        name: '客户满意度2',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '3',
        name: '服务工单',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '4',
        name: '物业收费',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '8',
        name: '安防管控',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '6',
        name: '设备能耗',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '7',
        name: '仓库信息',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '9',
        name: '员工考勤',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '12',
        name: '设备信息',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '13',
        name: '巡更分析',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '14',
        name: '员工报单',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '15',
        name: '存量资产概况',
        moduleType: '3x2',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '16',
        name: '资产处置概况',
        moduleType: '1x2',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '17',
        name: '存量资产分布',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '18',
        name: '处置资产分布',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '19',
        name: '园区概况',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '21',
        name: '项目图片',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '22',
        name: '园区环境指数',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '20',
        name: '园区服务体系',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '24',
        name: '园区活动',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '25',
        name: '企业人才引进',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '26',
        name: '行业分布',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '27',
        name: '园区服务趋势',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '28',
        name: '收入规模分布',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '29',
        name: '纳税规模分布',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '30',
        name: '园区专利分布',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '31',
        name: '客户满意度',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '32',
        name: '园区整体概况',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '33',
        name: '视频监控',
        moduleType: '2x2',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '34',
        name: '人员出入详情',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '35',
        name: '园区能耗详情',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '36',
        name: '园区车位详情',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '37',
        name: '园区车辆统计',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '38',
        name: '园区监控告警',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '39',
        name: '园区周界告警',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '40',
        name: '运营概况',
        moduleType: '2x2',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '41',
        name: '园区经营收入',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '42',
        name: '租金收入概况',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '43',
        name: '园区服务体系',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '44',
        name: '年度出租趋势',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '11',
        name: '任务看板',
        moduleType: '1x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '46',
        name: '租赁资源概况',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '47',
        name: '目标达成概况',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '48',
        name: '租金收入趋势',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '49',
        name: '本年租赁趋势',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '50',
        name: '管理主体目标达成',
        moduleType: '2x2',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '51',
        name: '本年空置情况',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      },
      {
        id: '52',
        name: '本年签约变化',
        moduleType: '2x1',
        moduleSeat: [],
        refreshInterval: 0,
        organType: 0,
        show: false
      }
    ],
    organId: 1000279,
    organModel: {},
    isIndex: true,
    pageName: ''
  },
  mutations: {
    // 改变主题设置
    CHANGETHEMECONFIG (state, data) {
      switch (data.type) {
        case 'moduleTheme':
          state.themeConfig.moduleTheme =
            data.newData === 1 ? 'default' : 'flat'
          break
        case 'echartsTheme':
          state.themeConfig.echartsTheme =
            data.newData === 1 ? 'default' : 'flat'
          break
        case 'backgroundTheme':
          state.themeConfig.backgroundTheme = data.newData.toString()
          break
        case 'isSetting':
          state.themeConfig.isSetting = data.newData
          break
        case 'all':
          state.themeConfig = data.newData
          break
      }
    },
    // 改变模块列表
    CHANGEMODULELIST (state, data) {
      state.moduleList = data
    },
    // 改变组织机构
    CHANGEORGAN (state, data) {
      state.organId = data.organId
      state.organModel = data.organModel ? data.organModel : {}
    },
    // 改变是否是首页
    CHANGEPAGEINDEX (state, data) {
      state.isIndex = data
    },
    // 改变二级页面头部名字
    CHANGEPAGENAME (state, data) {
      state.pageName = data
    }
  },
  actions: {
    changeThemeConfig ({ commit }, data) {
      commit('CHANGETHEMECONFIG', data)
    },
    changeOrgan ({ commit }, data) {
      commit('CHANGEORGAN', data)
    },
    changePageIndex ({ commit }, data) {
      commit('CHANGEPAGEINDEX', data)
    }
  }
})
export default store
